package com.joven.infra.common.exception;

import lombok.Data;
import lombok.EqualsAndHashCode;

@EqualsAndHashCode(callSuper = true)
@Data
public class ApiException extends RuntimeException {

    private static final long serialVersionUID = 1;

    /**
     * 异常状态码
     */
    private Integer code;

    /**
     * 异常信息
     */
    private String message;

    public static ApiException of(Integer code, String message) {
        ApiException exception = new ApiException();
        exception.setCode(code);
        exception.setMessage(message);
        return exception;
    }
}
